// 设置本地缓存
export function setLocalStorage(key, value, expiredTime) {
  const data = {
    value: value,
    expiredTime: new Date().getTime() + expiredTime
  };
  localStorage.setItem(key, JSON.stringify(data));
}

// 获取本地缓存
export function getLocalStorage(key) {
  const data = JSON.parse(localStorage.getItem(key));
  if (data && new Date().getTime() < data.expiredTime) {
    return data.value;
  } else {
    localStorage.removeItem(key);
    return null;
  }
}

// 删除缓存
export function remove(key){
  localStorage.removeItem(key);
}